Namespace Unsafe

Functions

Link copied to clipboard
function burn(account: account, asset: asset, amount: big_integer)

Deletes tokens from an account's balance, decreasing the total supply by the amount being burned. It's marked as Unsafe, as it doesn't check who is authorizing the burning, meaning any user could burn tokens from any account if this was exposed.

The functionality of burn can be expanded by using before_burn and after_burn

Throws if the required assets cannot be burned. Common cases include:

  • the amount to burn is not in the accepted range (0; 2^256) (exclusive)

  • some conditions added in development through burn extensions (before_burn or after_burn) aren't met

  • the account balance is lower than amount

Throws "UNAUTHORIZED BURNING" if the asset's issuing blockchain is not this blockchain

Throws "INSUFFICIENT BALANCE" if the account does not have enough of the asset to burn

Can only be called from an operation.

Link copied to clipboard
function mint(account: account, asset: asset, amount: big_integer)

Creates new tokens, increasing the total supply by the amount being minted, and gives them to an account. It's marked as Unsafe, as it doesn't check who is authorizing the minting, meaning any user could mint tokens to any account if this was exposed.

The functionality of mint can be expanded by using before_mint and after_mint

Throws "UNAUTHORIZED MINTING" if the asset's issuing blockchain is not this blockchain

Throws "INVALID AMOUNT" if the asset's total supply, increased by the amount being minted, is higher than 2^256.

Throws if the required assets cannot be minted. Common cases include:

  • the amount to mint is not in the accepted range (0; 2^256) (exclusive)

  • some conditions added in development through mint extensions (before_mint or after_mint) aren't met

Can only be called from an operation.

Link copied to clipboard
function recall_unclaimed_transfer(account: account, transfer_tx_rid: byte_array, transfer_op_index: integer)

Allows recalling a transfer that was sent to a non-existing account and was not used to create the account.

Throws "RECALL INACTIVE" if is_create_on_internal_transfer_enabled returns false.

Throws when any extension of recall_on_internal_transfer throws.

Link copied to clipboard
function register_asset(name: text, symbol: text, decimals: integer, blockchain_rid: byte_array, icon_url: text, type: text): asset

Registers a new asset on this chain. It's marked as Unsafe, as it allows creating entities and its usage must be restricted to ensure disk usage doesn't grow indefinitely. The starting supply will be 0.

Throws if the input parameters are invalid. Common cases include:

  • blockchain_rid is not 32 bytes long

  • strings are longer than 1024 characters

  • type is empty

  • uniqueness resolver is longer than 1024 bytes

  • decimals is not in the accepted range 0, 78 (inclusive)

  • icon_url is not a valid URL

Can only be called from an operation.

Link copied to clipboard
function transfer(from: account, to: account, asset: asset, amount: big_integer)

Transfers tokens to an existing account. Marked as Unsafe because it does not check whether the account authorized the transfer.

Throws if the required assets cannot be transferred. Common cases include:

  • the amount to transfer is not in the accepted range (0, 2^256) (exclusive)

  • some conditions added in development through transfer extensions (before_transfer or after_transfer) aren't met

  • the sender account's balance is lower than amount

Throws "SELF TRANSFER" if from equals to

Can only be called from operations.

Link copied to clipboard
function transfer_to_recipient_id(sender: account, recipient_id: byte_array, asset: asset, amount: big_integer)

Transfers tokens to a certain recipient. If the recipient exists, a normal transfer will take place. Otherwise, if account creation on transfer is enabled, the account creation procedure will be started. Marked as Unsafe because it does not check whether the account authorized the transfer.

Throws if the required assets cannot be transferred. Common cases include:

  • the amount to transfer is not in the accepted range (0, 2^256) (exclusive)

  • some conditions added in development through transfer extensions (before_transfer or after_transfer) aren't met

  • the sender account's balance is lower than amount

Throws "INVALID RECIPIENT" if the recipient does not exist and is_create_on_internal_transfer_enabled returns false.

Can only be called from operations.